package com.example.apigateway.common;

import com.example.apigateway.model.User;

/**
 * @author ：Anitaxiaofeng
 * @description：
 * @create 2018-06-23
 **/
public class UserContext {

    private static final ThreadLocal<User> USER_HOLDER = new ThreadLocal<>();

    public static  void setUser(User user) {
        USER_HOLDER.set(user);
    }


    public static User getUser() {
        return USER_HOLDER.get();
    }

    public static void remove() {
        USER_HOLDER.remove();
    }
}
